package com.example.micrstore.controller;

import com.example.micrapi.feign.UserServiceFeign;
import com.example.micrapi.pojo.User;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

/**
 * @description: 用户Controller
 * @author: uu
 * @date: 2024/3/9 17:46
 * @version: 1.0
 */
@Tag(name="用户接口")
@RestController("store")
public class UserController {
    @Autowired
    private UserServiceFeign userServiceFeign;
    @Operation(summary = "更新用户信息")
    @PutMapping("/")
    public ResponseEntity<Void> updateUserInfo(@RequestBody User user) {
        Boolean res = userServiceFeign.updateUserInfo(user);
        if (res) {
            return ResponseEntity.ok().build();
        }

        return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build();
    }
}
